<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui">
    <h:form>
        <p:remoteCommand name="importarProfessores" action="#{docenteCtrl.prepararImportacao()}" oncomplete="dlgImportacao.show();" update=":frmImportacao" />
    </h:form>
    
    <p:dialog widgetVar="dlgImportacao" modal="true" header="Importação de Professores" resizable="false" dynamic="true">
        <h:form id="frmImportacao">
            <p:panelGrid columns="2">
                <h:outputLabel value="Arquivo:" />
                <p:fileUpload fileUploadListener="#{docenteCtrl.handleArquivoCSVUpload}" mode="advanced" allowTypes="/(\.|\/)(csv|CSV)$/" dragDropSupport="true"
                              label="Escolher" auto="true" rendered="#{docenteCtrl.arquivoCSV == null}" update="@form" />
                
                <h:outputText value="#{docenteCtrl.arquivoCSV.fileName}" rendered="#{docenteCtrl.arquivoCSV != null}" />
            </p:panelGrid>
            
            <p:commandButton action="#{docenteCtrl.importarProfessores()}" value="Importar" update=":form-principal :form-sidebar" icon="ui-icon-arrowreturnthick-1-w" oncomplete="dlgImportacao.hide();" />
        </h:form>
    </p:dialog>
</ui:composition>